/**
  ******************************************************************************
  * @file    led.c
  * @author  Amaseing team
  * @version V1.0.0
  * @date    21-november-2013
  * @brief   Led driver
  *         
  ******************************************************************************  
  */ 
  
/* Private includes ----------------------------------------------------------*/ 
#include "led.h"

/* Private declarations ------------------------------------------------------*/
/* Private prototypes --------------------------------------------------------*/
/* Private defines -----------------------------------------------------------*/
/* Functions -----------------------------------------------------------------*/
void ledInit(void)
{
    // Init leds PD0, PD1, PD3 - PD7
	RCC->AHB1ENR |= RCC_AHB1Periph_GPIOD;
	GPIOD->MODER |= ((0x01<<0)|(0x01<<2)|(0x01<<6)|(0x01<<8)|(0x01<<10)|(0x01<<12)|(0x01<<14));
	GPIOD->OTYPER &= ~((1<<0)|(1<<1)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7));
	GPIOD->OSPEEDR |= ((0x03<<0)|(0x03<<2)|(0x03<<6)|(0x03<<8)|(0x03<<10)|(0x03<<12)|(0x03<<14));
	GPIOD->PUPDR &= ~((0x01<<0)|(0x01<<2)|(0x01<<6)|(0x01<<8)|(0x01<<10)|(0x01<<12)|(0x01<<14));
    
	//All off
	GPIOD->ODR |= ((1<<0)|(1<<1)|(1<<3)|(1<<4)|(1<<5)|(1<<6)); 
	GPIOD->ODR &= ~(1<<7);
}
